// 1. 抽象处理器
public abstract class Logger
{
  protected LogLevel Level;
  protected Logger NextLogger;

  public void SetNext(Logger next)
  {
    NextLogger = next;
  }

  public void LogMessage(LogLevel level, string message)
  {
    if (Level <= level)
    {
      Write(message);
    }
    NextLogger?.LogMessage(level, message); // 传递给下一个
  }

  protected abstract void Write(string message);
}